
import { ReqParameters } from '@/api/hospitalList/HospitalList';
import { getdepartmentValue, getdepartmentValueList } from '@/api/hospitalList/model/hospitalListType';
import { Card, Col, Pagination, Row, Table, Tag, Tree } from 'antd'
import { ColumnsType } from 'antd/lib/table';
import React, { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom';

export default function Hospitalscheduling() {
    let { hoscode } = useParams()
    // 存储科室状态
    let [parameters, setparameters] = useState<getdepartmentValueList>([])
    // 存储第一层分类
    let [firstType, setfirstType] = useState<string[]>([])
    // 表格数据
    const columns: ColumnsType<any> = [
        {
            title: '序号',
            render(key, value, index) {
                return index + 1

            }

        },
        {
            title: '职称',
            dataIndex: 'age',
        },
        {
            title: '号源时间',
            dataIndex: 'age',
        },
        {
            title: '总预约数',
            dataIndex: 'age',
        },
        {
            title: '剩余预约数',
            dataIndex: 'age',
        },
        {
            title: '挂号费(元)',
            dataIndex: 'age',
        },
        {
            title: '擅长技能',
            dataIndex: 'age',
        }
    ];
    //   初始化获取科室列表数据
    let getParameters = async () => {
        let res = await ReqParameters(hoscode as string)
        let aa = res.map((Iteam) => {
            return Iteam.depcode
        })
        let newres = res.map((Iteam) => {
            Iteam.disabled = true
            return Iteam
        })
        setfirstType(aa)
        setparameters(newres)
    }
    //
    // 模拟生命周期
    useEffect(() => {
        getParameters()
    }, [])
    return (
        <Card>
            {/* 面包屑导航 */}
            <p>选择：XXXX/XXXX/XXXX</p>
            {/* 内容区 */}
            <Row gutter={30}>
                {/* 内容区左侧 */}
                <Col span={5}>
                    <div style={{ border: "1px solid #ccc", overflow: "auto", height: "300px" }} >
                        <Tree

                            // defaultExpandedKeys={firstType}
                            // defaultSelectedKeys={['0-0-0', '0-0-1']}
                            // defaultCheckedKeys={['0-0-0', '0-0-1']}
                            treeData={parameters as []}
                            fieldNames={{ title: "depname", key: "depcode" }}
                            expandedKeys={firstType}
                        />
                    </div>

                </Col>
                {/* 内容右侧 */}
                <Col span={19}>
                    <div>
                        <Tag color="green">
                            <div>2022-04-27 周三</div>
                            <div>38 / 100</div>
                        </Tag>
                        <Tag>
                            <div>2022-04-27 周三</div>
                            <div>38 / 100</div>
                        </Tag>
                        <Tag>
                            <div>2022-04-27 周三</div>
                            <div>38 / 100</div>
                        </Tag>
                        <Tag>
                            <div>2022-04-27 周三</div>
                            <div>38 / 100</div>
                        </Tag>
                        <Tag>
                            <div>2022-04-27 周三</div>
                            <div>38 / 100</div>
                        </Tag>
                    </div>
                    <Pagination className='mt' defaultCurrent={6} total={500} />
                    {/* 表格 */}
                    <Table className='mt' columns={columns} />


                </Col>


            </Row>
        </Card>
    )
}
